import { Radio, Tabs } from "antd";
import service from "../../service";
import React, { useState, useEffect } from "react";
import axios from "axios";
import services from "../../service";

const Shop = ({ onSearch }) => {
  const [input, setInput] = useState("");
  const [products, setProducts] = useState([]);
  let getGoods = async () => {
    const res = await services.GetGoods();
    console.log(res);
    setProducts(res);
  };
  useEffect(() => {
    getGoods();
  }, []);
  return (
    <div>
      <input
        type="text"
        placeholder={"请输入搜索信息"}
        style={{
          width: 300,
          height: 30,
          border: "1px solid blue",
          borderRadius: 3,
          padding: 5,
        }}
      />
      <button>搜索</button>

      <div>
        {products.map((product) => (
          <div key={product.id}>
            <div>{product.img}</div>
            <p>{product.title}</p>
            <p>{product.price}</p>
          </div>
        ))}
      </div>

      {/* <Tabs
        defaultActiveKey="1"
        type="card"
        items={new Array(3).fill(null).map((_, i) => {
          const id = String(i + 1);
          return {
            label: `Card Tab ${id}`,
            key: id,
            children: `Content of card tab ${id}`,
          };
        })}
      /> */}
    </div>
  );
};
export default Shop;
